﻿using TianYuan.Core.Dependency;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Dynamic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace TianYuan.Data.Dapper
{
    /// <summary>
    /// 数据库上下文
    /// </summary>
    public interface IDbContext: ISqlSugarClient, IPerWebRequestDependency
    {
        /// <summary>
        /// 事务是否开启
        /// </summary>
        bool HasActiveTransaction { get; }
        /// <summary>
        /// DbConnection,用以支持Dapper,SqlHelper等等查询方式查询方式
        /// </summary>
        IDbConnection Connection { get; }
        /// <summary>
        /// 开启事务
        /// </summary>
        /// <param name="isolationLevel"></param>
        void BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted);
        /// <summary>
        /// 提交事务
        /// </summary>
        void Commit();
        /// <summary>
        /// 回滚事务
        /// </summary>
        void Rollback();

        #region  SqlSugarClient接口
        
        #endregion


    }
}
